package com.learn.scrm;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;

import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.stream.Collectors;

/**
 * @author : Yu.Tan
 * @date : 2023/3/2 11:07
 * @desc : **
 */
public class NumberTest {
    public static void main(String[] args) {
//            int count=12 ;
//            DecimalFormat df=new DecimalFormat("HF"+"000000");
//            String format = df.format(count);
//            System.out.println(format);

        Date matchFollowTime = DateUtil.offsetDay(new Date(), -1 ).toJdkDate();
        System.out.println(DateUtil.format(matchFollowTime, DatePattern.NORM_DATETIME_PATTERN));

//        Date jdkDate = DateUtil.offsetDay(new Date(), -19).toJdkDate();
//        Date toJdkDate = DateUtil.offsetHour(jdkDate, 1).toJdkDate();
        System.out.println(DateUtil.format(matchFollowTime, DatePattern.NORM_DATETIME_PATTERN));

//        System.out.println(matchFollowTime==toJdkDate);
        long l = DateUtil.betweenDay(new Date(), new Date(), true);
        int i = DateUtil.compare(new Date(), new Date());
        System.out.println("l="+l);
        System.out.println("i="+i);


        long followDays = DateUtil.betweenDay(new Date(), new Date(), true) + 1;
        System.out.println(followDays);


        System.out.println("1".equals(null));

//        Integer a=null;
//        System.out.println(1==a);

        StringBuilder sql = new StringBuilder();
        String saId="123";

        sql.append("AND ( ")
                .append(" assign_user_code = '").append(saId).append("'")
                .append(" OR ").append(" sa_id = '").append(saId).append("' ")
                .append(" OR ").append(" clean_user_id = '").append(saId).append("' ")
                .append(")");

        System.out.println(sql.toString());

        Integer x=1;
        System.out.println(x.equals(null));


        Date date = DateUtil.endOfDay(DateUtil.offsetHour(new Date(), 1)).toJdkDate();
        System.out.println(date);


        String numbers = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyz0123456789-",12);
        String numbers1 = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyz0123456789-",24);
        System.out.println(numbers);
        System.out.println(numbers1);



        String[] SAN_CHE_CHANNEL_CODE={"746","741","765"};

        String sqlTpl = "( %s = %s)";
        for (String s : SAN_CHE_CHANNEL_CODE) {
            String sourceCode2 = String.format(sqlTpl, "user_source_code_2", s);
        }

        String sql1 = Arrays.stream(SAN_CHE_CHANNEL_CODE).map(r -> String.format(sqlTpl, "user_source_code_2", r)).distinct().collect(Collectors.joining(" or "));

        System.out.println(sql1);


        String s="垂直媒体-懂车帝";
        String s1="垂直媒体-懂车帝-易车网-询价";

        boolean startsWith =  s.startsWith(s1);
        boolean startsWith1 =  s1.startsWith(s);
        System.out.println(startsWith);
    }
}
